package org.deva.erp.common.util;

import java.io.Serializable;

import org.deva.erp.base.util.AppAttributes;

/**
 * Project: erp<br>
 * Description: 权限参照类，控制当前用户对当前菜单的操作权限<br>
 * Copyright (c) 2012<br>
 * All Rights Reserved.<br>
 * 
 * @author <a href="mailto:gly420@163.com">GuanLuYong</a><br>
 */
public class Permission implements Serializable {
	private static final long serialVersionUID = 1L;
	// 查询
	private boolean query = false;
	// 新增
	private boolean add = false;
	// 修改
	private boolean modify = false;
	// 删除
	private boolean remove = false;
	// 审核
	private boolean check = false;
	// 关联关系
	private boolean communicate = false;

	public Permission() {
	}

	public Permission(Long value) {
		if ((value & AppAttributes.ERP_RESOURCE_PERMISSION_QUERY) != 0) {
			query = true;
		}
		if ((value & AppAttributes.ERP_RESOURCE_PERMISSION_ADD) != 0) {
			add = true;
		}
		if ((value & AppAttributes.ERP_RESOURCE_PERMISSION_MODIFY) != 0) {
			modify = true;
		}
		if ((value & AppAttributes.ERP_RESOURCE_PERMISSION_DROP) != 0) {
			remove = true;
		}
		if ((value & AppAttributes.ERP_RESOURCE_PERMISSION_CHECK) != 0) {
			check = true;
		}
		if ((value & AppAttributes.ERP_RESOURCE_PERMISSION_COMMUNICATE) != 0) {
			communicate = true;
		}
	}

	public boolean isQuery() {
		return query;
	}

	public void setQuery(boolean query) {
		this.query = query;
	}

	public boolean isAdd() {
		return add;
	}

	public void setAdd(boolean add) {
		this.add = add;
	}

	public boolean isModify() {
		return modify;
	}

	public void setModify(boolean modify) {
		this.modify = modify;
	}

	public boolean isCheck() {
		return check;
	}

	public void setCheck(boolean check) {
		this.check = check;
	}

	public boolean isCommunicate() {
		return communicate;
	}

	public void setCommunicate(boolean communicate) {
		this.communicate = communicate;
	}

	public boolean isRemove() {
		return remove;
	}

	public void setRemove(boolean remove) {
		this.remove = remove;
	}

}
